from .configs_singleton import Class_configs
import time
import pathlib
from queue import Queue

# Заменить на ассинхронный
obj_push_mess = Queue()
# !!! queue_message_thread = Queue()
# !!! stopwatch = Queue()
stream_speech = Queue()
stop_sr = Queue()
stop_sr.put("True")

# =============BD=============
class_configs = Class_configs()
cmds = class_configs.get_config()
settings = class_configs.get_settings()
languages = class_configs.get_language()
# tags = class_configs.get_tags()
numbers = class_configs.get_numbers()
cmds_void = cmds["void"]
name_voice_help = cmds["name"][0]
# =============/BD=============


# =============API=============
comuniction_str_api = ""
speech_recognition_str_api = ""
speech_recognition_str_api_one = ""
cmd_str_api = ""
tags_list_api = []
tags_dict_api = {}
tags_int_api = None
speech_blocking = None
# =============/API=============


# !!! work_mode = ""
# work_mode = "combat_mode"
# Разобраться

"""разделение функций и меток при декодирование распознанных строк class Cmu_cmd
 Разделение == True"""

KERNEL_START_TIME = time.time()
time_out_mess_start = 0
time_out_mess_len = 0
say_expectatio = 10
exit_flag = False
value_timer_sleep = 60
PROBABILITY_CMD_CONST = 98
time_of_last_action = KERNEL_START_TIME
buff_mess_speech = {"mess": [], "data": []}
buff_list_mess_comm = {"mess": [], "data": []}


message_read = True
way_modul_file = ""
decoder_tags_vs_str = ""
exit_set_config = True
flexible_probability_cmd_cmds = True
count_error_word = 3
event_message = "cheek_message"


# os.path.dirname(os.path.abspath(__file__))
# file_project = '/media/doctor/disk/fileprogect/Jarvis_core/core'
path_core = str(pathlib.Path(__file__).parent.resolve())
print(path_core)
path_core = path_core[0 : path_core.rfind("/")]
print(path_core)
path_core = (
    "/home/arksm/Рабочий стол/МОИ ПРОЕКТЫ/программирование/Core_voice_help_2_0/src/"
)
way_egg = f"{path_core}/egg/"
way_egg_json = f"{path_core}/egg_json/"
path_bd = f"{path_core}/database/"
project_way = f"{path_core}"
protocol_file_dir = f"{project_way}protocol/"
# /media/doctor/disk/fileprogect/Jarvis_Core/protocol/
model_way = f"{path_bd}vosk-model-small-ru-0.15/"
model_mini_way = f"{path_bd}vosk-model-small-ru-0.15/"
way_home_dir = "/home/doctor/"

language_name = settings["language"]
default_modul = settings["default_modul"]
dict_value_str_voice = settings["dict_value_str_voice"]
# Предел нечёткого поиска распознование ключевых слов
probability_cmd = settings["probability_cmd"]

name_separation = settings["name_separation"]
func_separation_name = settings["func_separation_name"]
kol_void_err = settings["kol_void_err"]
resualt_sr = settings["resualt_sr"]
tags_decoder_flag = settings["tags_decoder_flag"]

turning_message = settings["turning_message"]
one_func = settings["one_func"]
# Телеметрия вызова функций
meta_data = settings["meta_data"]
value_print_separation_file_manager = settings["value_print_separation_file_manager"]
# разрешение на активацию
enabling_activation = settings["enabling_activation"]
# разрешение проверку речи
permission_check_speech = settings["permission_check_speech"]
# increase_accuracy_factor = True
buff_mess_speech_count = settings["buff_mess_speech_count"]
buff_mess_comm_count = settings["buff_mess_comm_count"]
blocking_update_flag = settings["blocking_update_flag"]

# message_blocking = settings["message_blocking"]

sr_err_permmusion_name_params = settings["sr_err_permmusion_name_params"]
count_sr_err_permmusion_name_value = settings["count_sr_err_permmusion_name_value"]
number_of_seconds_of_inactivity = settings["number_of_seconds_of_inactivity"]
sleep_prohibition = settings["sleep_prohibition"]
flag_sleep_core = settings["flag_sleep_core"]
version = settings["version"]
rate = settings["rate"]
pitch = settings["pitch"]
hidden_function = settings["hidden_function"]

temporary_files = settings["temporary_files"]

# print(cmds_void)
